#!/bin/sh

if [ "$1" = "help" ]; then
    echo "*** Description ***" 
    echo "Search for a package in distro repos, runs fuzzypkg if all else fails"
    echo ""
    echo "*** Usage ***"
    echo "pkg-search <package-name>"
    echo ""
    echo "*** Parameters ***"
    echo "package-name: Name of package to search for"
    echo ""
    echo "*** Options ***"
    echo ""
    exit 0
fi

void () {
    if [ -f /usr/bin/xbps-install ]; then
        xbps-query -Rs "$@"
        exit 1
    fi
}

void "$@"
[ -f /usr/bin/fuzzypkg ] && fuzzypkg "$@"
echo "Cannot determain package manager"
